package com.gdkj.enums;

public enum DiggingGoodsTypeEnums {
    HF(1, "话费"),
    HB(2, "红包"),
    XJ(3, "现金"),
    JD(4, "金豆"),
    JB(5, "金币");

    private Integer type;

    private String name;

    DiggingGoodsTypeEnums(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据type获取name值
     * @author chenyanqian
     * @date 2022/11/2
     * @param type : code
     * @return : java.lang.String
     */
    public static String getNameByType(Integer type){
        DiggingGoodsTypeEnums[] enums = DiggingGoodsTypeEnums.values();
        for (DiggingGoodsTypeEnums typeEnums : enums){
            if(typeEnums.type.equals(type)){
                return typeEnums.name;
            }
        }
        return null;
    }
}
